import 'package:flutter/material.dart';
import 'package:flutter_demo/res/resources.dart';

class CircleButton extends StatelessWidget {
  final Widget icon;
  final String text;
  final int unreadMessages;

  const CircleButton({
    Key key,
    this.icon,
    this.text,
    this.unreadMessages = 0
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(5.0),
      width:60,
      child: GestureDetector(
        child: Stack(
          children: <Widget>[
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                icon,
                Gaps.hGap4,
                Text(
                  text,
                  style:TextStyle(
                    fontSize:Dimens.font_sp14,
                    fontWeight: FontWeight.w200,
                    color:Colours.text
                  )
                ),
                
              ],
            ),
            unreadMessages==0?Gaps.empty:
            Positioned(
              top:2,
              right:0,
              child: Container(
                alignment: Alignment.center,
                padding: EdgeInsets.symmetric(vertical:2,horizontal:5),
                decoration: BoxDecoration(
                  border:Border.all(color: Colors.white,width:1),
                  borderRadius: BorderRadius.circular(20/2.0),
                  color:Colors.red,
                ),
                child:Text(
                  '${unreadMessages}',
                  style:TextStyle(
                    fontSize: 12.0,
                    fontWeight: FontWeight.bold,
                    color:Colors.white,
                  )
                )
              ),
            )
          ],
        ),
      ),
    );
  }
}